/**
 * 
 */
package com.net.service.user;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.net.controller.model.UserParam;
import com.net.dao.UserDAO;
import com.net.model.User;

/**
 *
 * @author fengcheng
 * @date 2018年6月16日 下午3:46:28
 */
public class UserServiceImpl implements UserService {
	private UserDAO userDAO;
	/**
	 * @param userDAO the userDAO to set
	 */
	@Autowired
	public void setUserDAO(UserDAO userDAO) {
		this.userDAO = userDAO;
	}
	/* (non-Javadoc)
	 * @see com.net.service.user.UserService#insertUser(com.net.model.User)
	 */
	@Override
	public void insertUser(UserParam user) {
		userDAO.insertUser(user);
	}

	/* (non-Javadoc)
	 * @see com.net.service.user.UserService#getById(int)
	 */
	@Override
	public User getById(int id) {
		return userDAO.getById(id);
	}

	/* (non-Javadoc)
	 * @see com.net.service.user.UserService#getByName(java.lang.String)
	 */
	@Override
	public User getByName(String name) {
		return userDAO.getByName(name);
	}
	@Override
	public User getByNameAndPwd(String name, String pwd) {
		return userDAO.getByNameAndPwd(name, pwd);
	}
	@Override
	public boolean delUser(int id) {
		if(userDAO.del(id) == 1){
			return true;
		}
		return false;
	}
	@Override
	public boolean editUser(UserParam user) {
		if(userDAO.edit(user) == 1){
			return true;
		}
		return false;
	}
	@Override
	public List<User> getAll() {
		return userDAO.getAll();
	}

}
